package com.care.inquiry.server.im;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @version: java version 1.8
 * @author: cuiweijie
 * @date: 2024-03-25 19:37
 */

@Getter
@AllArgsConstructor
public enum CommandType {

    /**
     * 建立连接
     */
    CONNECTION(10001),
    /**
     * 聊天消息
     */
    CHAT(10002),

    ERROR(-1),
    ;
    private final Integer code;

    public static CommandType match(Integer code){
        for (CommandType value : CommandType.values()) {
            if(value.getCode().equals(code)){
            return value;
            }
        }
        return ERROR;
    }



}
